# Contributor: Brandon Boese <brandonboese@protonmail.com>
# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=lomiri-system-settings
pkgver=1.0.2
pkgrel=0
pkgdesc="System Settings application for Lomiri"
url="https://gitlab.com/ubports/development/core/lomiri-system-settings"
# armhf: blocked by lomiri-ui-toolkit
# s390x, riscv64, ppc64le: blocked by ayatana-indicator-datetime
arch="all !armhf !s390x !riscv64 !ppc64le"
license="GPL-3.0-only"
depends="
	accountsservice
	ayatana-indicator-bluetooth
	ayatana-indicator-datetime
	ayatana-indicator-power
	lomiri-content-hub
	lomiri-indicator-network
	lomiri-settings-components
	lomiri-ui-toolkit
	qt5-qtmultimedia
	"
makedepends="
	accountsservice-dev
	click-dev
	cmake
	cmake-extras
	geonames-dev
	gnome-desktop-dev
	gsettings-qt-dev
	icu-dev
	intltool
	libqtdbusmock
	networkmanager-dev
	qt5-qtbase-dev
	qt5-qtdeclarative
	qt5-qtdeclarative-dev
	samurai
	upower-dev
	"
checkdepends="
	mesa-dri-gallium
	py3-dbusmock
	py3-xdg
	xvfb-run
	"
subpackages="$pkgname-lang"
source="https://gitlab.com/ubports/development/core/lomiri-system-settings/-/archive/$pkgver/lomiri-system-settings-$pkgver.tar.gz
	0001-Pass-missing-parameter-to-dbusmock-bluez-PairDevice-.patch
	0002-Add-flag-to-compile-with-upstream-accountsservice.patch
	0003-Migrate-to-upstream-maliit-keyboard.patch
	0004-Use-qmltestrunner-qt5.patch
	"
options="!check" # fails tst-bluetooth-device
# Somehow on armv7 the tests try to use zink from mesa which doesn't work
case "$CARCH" in
	armv7) options="!check" ;;
esac

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=None
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
9cf51248dddf35e60cc42c761e173db25296061710390deb4fd5cb606e43591ec51d091b6af576ce3b8dc20c21733d0dc1ee86c4057b9f3e1e25a72f6d9debe9  lomiri-system-settings-1.0.2.tar.gz
ebc9f284bce142eb01141acdc289039fbc43d5809ccdab56b8f909779d4c05372bf72226bf801d097b04f8e500c27372c15274f92a5c2b3343973a976b292c22  0001-Pass-missing-parameter-to-dbusmock-bluez-PairDevice-.patch
0fdf2d30f26768fd8568e7f7c1062c7b5a81dd6b47e26d7e61dae2217bc636a494f4e3e41ec612969ea61b7525be649c1adb9b2fb5784de91759852075c8b3bb  0002-Add-flag-to-compile-with-upstream-accountsservice.patch
35aac9f5efe86aa8095fad302e852958b24ecb1e10301a86e14f8576b7a3c072c7c40da052e2a8a3ec5d0bdea4adac4049b6514b27d2a96ccaef3060c7c2fa38  0003-Migrate-to-upstream-maliit-keyboard.patch
2f75b8912f25b6a700d69954911a6ccb1c222ff060e22e15131628004619b12b28646d28e057983118cb356ccf54b37e898a1b93b1b7659e54498ed3b8d21f53  0004-Use-qmltestrunner-qt5.patch
"
